import { Controller, Get, Query, UseGuards } from "@nestjs/common";
import { ApiOperation, ApiTags } from "@nestjs/swagger";
import { Roles } from "../auth/roles.decorator";
import { AdminGetAddressListDto, AdminGetUserListDto } from "./dto/user.dto";
import { AdminUserService } from "./user.service";
import { AuthEnum } from "/@/enum/auth.enum";
import { RolesGuard } from "/@/logical/adminModule/auth/roles.guard";

@ApiTags("adminUser")
@Controller("user")
@UseGuards(RolesGuard)
export class AdminUserController {
  constructor(private readonly adminUserService: AdminUserService) {
    //
  }

  @Get("getUserList")
  @Roles(AuthEnum.USER, AuthEnum.USER_VIEW)
  @ApiOperation({ summary: "获取平台用户列表" })
  async getUserList(@Query() query: AdminGetUserListDto): Promise<any> {
    return this.adminUserService.getUserList(query);
  }

  @Get("getAddressList")
  @Roles(AuthEnum.USER, AuthEnum.USER_VIEW)
  @ApiOperation({ summary: "获取平台用户的地址列表" })
  async getAddressList(@Query() query: AdminGetAddressListDto): Promise<any> {
    return this.adminUserService.getAddressList(query);
  }
}
